package cn.webestar.scms.task.api;

import cn.webestar.scms.commons.R;
import cn.webestar.scms.commons.api.PageVO;
import cn.webestar.scms.task.api.dto.Task.*;
import cn.webestar.scms.task.entity.Task;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 * 任务
 */
@Tag(name = "任务")
@FeignClient(contextId = "Task", name = "microsvc-task", path = "/svcapi/Task")
public interface TaskApi {

    @Operation(summary = "create")
    @PostMapping("create")
    R<Task> create(@RequestBody TaskCreateDTO body);

    @Operation(summary = "delete")
    @PostMapping("delete")
    R<Boolean> delete(@RequestParam("id") String id);

    @Operation(summary = "update")
    @PostMapping("update")
    R<Task> update(@RequestBody TaskUpdateDTO body);

    @Operation(summary = "findById")
    @PostMapping("findById")
    R<Task> findById(@RequestParam("id") String id);

    @Operation(summary = "findByIds")
    @PostMapping("findByIds")
    R<Map<String, Task>> findByIds(@RequestBody Set<String> ids);

    @Operation(summary = "page")
    @PostMapping("page")
    R<PageVO<Task>> page(@RequestBody TaskPageDTO body);

    @Operation(summary = "findOne")
    @PostMapping("findOne")
    R<Task> findOne(@RequestBody TaskSimpleDTO body);

    @Operation(summary = "limitList")
    @PostMapping("limitList")
    R<List<Task>> limitList(@RequestBody TaskLimitDTO body);

}
